package com.tl.boot.main.configuration;

import com.tl.boot.main.filter.PreRequestFilter;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;

/**
 * com.tl.boot.main.configuration -- LocalFilterConfig
 * Description:
 * Created by joshua_liu <a href="mailto:joshualwork@163.com"></a>
 * On 2019/9/11 11:06
 */
//@Configuration
public class LocalFilterConfig {
    @Bean
    public FilterRegistrationBean companyUrlFilterRegister() {
        FilterRegistrationBean registration = new FilterRegistrationBean();
        //注入过滤器
        registration.setFilter(new PreRequestFilter());
        //拦截规则
        registration.addUrlPatterns("/*");
        //过滤器名称
        registration.setName("preRequestFilter");
        //过滤器顺序
        registration.setOrder(1);
        return registration;
    }

}
